//
//  JKSongsMessStatus.m
//  JiuKuGospel
//
//  Created by jiukuyinyue on 15-8-12.
//  Copyright (c) 2015年 JiuKuForApp. All rights reserved.
//

#import "JKSongsMessStatus.h"
#import "NetworkTool+LCAVPlay.h"


@implementation JKSongsMessStatus

- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    //    if ([dic objectForKey:@"remote"]) {
    //        self.fileUrl = dic[@"remote"];
    //    }
    if (dic[@"filePath"] == nil) {
        self.filePath = [NSString stringWithFormat:@"%@", [kNetworkTool mp3WithUrl:dic[@"fileUrl"]]];
    }

//    if ([dic objectForKey:@"album"] && [dic[@"album"] isEqualToString:@""] && dic[@"singerName"] != nil) {
//        self.album = dic[@"singerName"];
//        self.album_name = dic[@"singerName"];
//    }

    if ([dic objectForKey:@"id_id"] && dic[@"id"] == nil && dic[@"id_id"] != nil) {
        self.id = dic[@"id_id"];
    }
    if ([self.duration containsString:@":"] && [self.duration containsString:@"."]) {
        NSArray *array = [self.duration componentsSeparatedByString:@"."]; //从字符中分隔成2个元素的数组
        NSString *durationStr = array[0];
        if (durationStr.length >= 5) {
            self.duration = durationStr;
        }
    }
    return YES;
}




- (void)encodeWithCoder:(NSCoder *)aCoder { [self yy_modelEncodeWithCoder:aCoder]; }
- (id)initWithCoder:(NSCoder *)aDecoder { self = [super init]; return [self yy_modelInitWithCoder:aDecoder]; }
- (id)copyWithZone:(NSZone *)zone { return [self yy_modelCopy]; }

- (NSUInteger)hash { return [self yy_modelHash]; }
- (BOOL)isEqual:(id)object { return [self yy_modelIsEqual:object]; }

- (NSString *)description { return [self yy_modelDescription]; }

@end
